package com.eascs.web.o2o.scheduler.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.eascs.app.dao.PageResult;
import com.eascs.app.dao.mongo.MongoPageQuery;
import com.eascs.web.o2o.scheduler.dao.ScheduMongoDao;
import com.eascs.web.o2o.scheduler.entity.MongoLogoEntity;

@Service
public class MongoSchedulService {
	
	@Autowired
	protected ScheduMongoDao dao;
	
	/**
	 * 插入
	 * @param entity
	 */
	public void insert(MongoLogoEntity entity){
		dao.insert(entity);
	}
	
	/**
	 * Mongo查询
	 * @param entity
	 * @param pageSize
	 * @param pageIndex
	 * @return
	 */
	public PageResult<Object[]> queryPage(MongoLogoEntity entity, int pageSize, int pageIndex){
		MongoPageQuery<Object[]> sqlPageQuery = new MongoPageQuery<Object[]>(Object[].class, pageSize, pageIndex);
		String querySql = "db.mongo_logo_info.find()";
		sqlPageQuery.setQuerySql(querySql);
		return dao.findDataWithPage(sqlPageQuery);
	}
}
